<!--
 * @description  :情报首页的情报登记list
 * @descriptionDetail:情报首页的情报登记list
 * @copyright    : 浙江烟草
 * @author       : mc
 * @create       : 2022-10-09 22:21:21
-->
<template>
  <view class="lt-root" @click="itemClick" style="display: flex;">
    <view class="lt-row-space">
      <view>
        <text class="lt-left-label">
          线索编号：
        </text>
        <text class="lt-right-value">
          {{ itemInfo.clueCode }}
        </text>
      </view>
      <view>
        <u-tag :text="itemInfo.statusName" :type="itemInfo.caseCode?'primary':'error'" shape="circle" border-color="#ffffff00"></u-tag>
      </view>
    </view>
    <view class="lt-row">
      <view class="lt-row-half7" style="display: flex;">
        <view class="lt-left-label">
          案件编号：
        </view>
        <view>
          <text class="lt-right-value" v-for="(it,idx) of (itemInfo.caseCode||'').split(',')" :key="idx" @click.stop="showCaseInfo(itemInfo,idx)" :class="[itemInfo.caseCode ? 'color-primary':'color-error']" style="word-break: break-word;display: block;">
            {{ caseCode(it,idx,itemInfo) }}
          </text>
        </view>
      </view>
      <view class="lt-row-half3" v-if="itemInfo.clueReports" style="text-align: right;">
        <text class="lt-right-value color-primary" @click.stop="showClueReport">
          举报记录表
        </text>
      </view>
    </view>
    <view class="lt-row flex">
      <view class="lt-row-half5">
        <text class="lt-left-label">
          登记人：
        </text>
        <text class="lt-right-value">
          {{ itemInfo.creatorName }}
        </text>
      </view>
      <view class="lt-row-half5">
        <text class="lt-left-label">
          调查人：
        </text>
        <text class="lt-right-value">
          {{ itemInfo.investPersonName || '/' }}
        </text>
      </view>
    </view>
    <view class="lt-row">
      <view class="lt-row-half1">
        <text class="lt-left-label">
          接收时间：
        </text>
        <text class="lt-right-value">
          {{ itemInfo.regDate }}
        </text>
      </view>
    </view>
    <view class="lt-row">
      <view class="lt-row-half6">
        <text class="lt-left-label">
          来源类型：
        </text>
        <text class="lt-right-value">
          {{ itemInfo.sourceTypeName }}
        </text>
      </view>
    </view>
    <view class="lt-row">
      <text class="lt-left-label">
        线索简介：
      </text>
      <text class="lt-right-value">
        {{ itemInfo.name }}
      </text>
    </view>
  </view>
</template>

<script>
export default{
  name:"ListItemIntelligenceRegister",
  props:{
    itemInfo:{
      type: Object,
      default:() => { return {} },
    },
    fromType:{
      type: String,
      default: "register",
    },
  },
  data(){
    return {

    };
  },
  methods:{
    itemClick(){
      let sp = this.$root.topSelf || '';
      this.setRouteParam(this.itemInfo);
      this.$u.route({
        url:"/pages/intelligence/intelligenceFilesAdd/registration",
        params:{
          fromType: this.fromType,
          from: 1,
          topSelf: sp,
        },
      });
    },
    showClueReport () {
      let param = {
        bizUuid:this.itemInfo.bizUuid,
        uuid: this.itemInfo.reportUuid || '',
        status: this.itemInfo.status,
        fromType: this.fromType,  // 用于区分登记派发和结果反馈  register登记派发
        detailInfo:this.itemInfo,  // 举报记录表中查看线索详情
      }
      this.setRouteParam({ param: param, });
      this.$u.route({
        url:'/pages/intelligence/components/reportCardList',
        type:'to',
        params:{
          uuid: this.itemInfo.uuid,
        },
      });
    },
    caseCode (it,idx,itemInfo) {
      if (idx == 0 && this.$u.test.isEmpty(itemInfo.caseCode)) {
        return '未立案'
      } else {
        return it
      }
    },
    showCaseInfo(itm,idx){
      if(!this.itemInfo.caseCode) return;
      this.setRouteParam({
        caseCode: itm.caseCode.split(',')[idx],
        caseUuid: itm.caseUuid.split(',')[idx],
        from: "intelligence",
      });
      this.$u.route('/pages/case/offline/caseInfo');
    },
  },
}
</script>

<style scoped lang="scss">
@import "../list_item.scss";
.color-primary{
	color: $u-type-primary;
}
.color-error{
  color: $u-type-error;
}
</style>
